﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace University_students
{
    class Faculties
    {
        public string facultyName = "";

       public List<Departments> departmentList = new List<Departments>();
        public void AddDepartmentsToFaculties()
        {
           
            string choice = "";
            do
            {
                Console.WriteLine("Would you like to add new department? Y/N.");
                choice = Console.ReadLine();
                if (choice == "Y")
                {
                    Departments newDepartment = new Departments();
                    newDepartment.NameOfDepartment();
                    newDepartment.AddGropesToDepartments();
                    departmentList.Add(newDepartment);
                }
            } while (choice == "Y");
            
        }


        public void NameOfFaculty()
        {
            Console.WriteLine("Enter the name of faculty: ");
            facultyName = Console.ReadLine();
        }

        public void StraightPrintFaculty()
        {
            Console.WriteLine("Faculty name is - {0}.", facultyName);
            foreach (var singleDeparmnet in departmentList)
            {
                Console.WriteLine();
                singleDeparmnet.DepartmentInfo();
                singleDeparmnet.StraightPrintDeparment();
            }
        }

        public void PrintDepartDisplay()
        {
            foreach (var singleDeparmnet in departmentList)
            {
                Console.WriteLine();
                singleDeparmnet.DepartmentInfo();
                singleDeparmnet.PrintGropetDisplay("");
            }
        }

        public void FacultyInfo()
        {
            Console.WriteLine("Faculty name is - {0}.", facultyName);
            foreach (var singleDeparmnet in departmentList)
            {
                singleDeparmnet.DepartmentInfo();
            }
        }

        public void CertainDpeartmentPrintWithGropsOnly(string departChoice, string StudentsPrintchoice)
        {
            
            foreach (var singleDeparmnet in departmentList)
            {
                if(departChoice == "All")
                {
                    Console.WriteLine();
                    singleDeparmnet.DepartmentInfo();
                    singleDeparmnet.PrintGropetDisplay(StudentsPrintchoice);
                }
               else if(singleDeparmnet.departmentName == departChoice)
                {
                    Console.WriteLine();
                    singleDeparmnet.DepartmentInfo();
                    singleDeparmnet.PrintGropetDisplay(StudentsPrintchoice);
                }

            }
        }

        public void ForeachForStudentsStudyingOnTheDepartment()
        {
            Console.WriteLine("Which department you want to print?");
            string departChoice = Console.ReadLine();
            foreach (var singleDeparmnet in departmentList)
            {
               if (singleDeparmnet.departmentName == departChoice)
                {
                    Console.WriteLine();
                    singleDeparmnet.DepartmentInfo();
                    singleDeparmnet.PrintStudentsDirectly();
                }
                if (departChoice == "All")
                {
                    Console.WriteLine();
                    singleDeparmnet.DepartmentInfo();
                    singleDeparmnet.PrintStudentsDirectly();
                }

            }
        }

        public void PrintCertainGropeWithStudentsCertainPercentOfAchievmentMore(double choicePercent, string choiceGropeName)
        {
            foreach (var singleDeparmnet in departmentList)
            {
                singleDeparmnet.PrintCertainGrop(choicePercent, choiceGropeName);
            }
        }

        public void PrintCertainGropeWithStudentsCertainPercentOfAchievment(double choicePercent)
        {
            
            foreach (var singleDeparmnet in departmentList)
            {
                singleDeparmnet.PrintDirectStidentsForFaculty(choicePercent);
            }
        }

    }
}
